Skip to content

Fix potential NPE in ApiCallAttemptTimeoutTrackingStage #6332

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

L-Applin
Copy link
Contributor

fix potential NullPointerException in ApiCallAttemptTimeoutTrackingStage when exception is thrown before the tracker can be set in the context

Motivation and Context

Customer reported NPE because the call to context.apiCallAttemptTimeoutTracker() returns null. There is some code that could throw an exception before the timeoutTracker is set on the context, particularly if the ScheduledExecutorService rejects the scheduled task for some reason.

Modifications

Added null check

Testing

ran unit tests

…age when exception is thrown before the tracker can be set in the context
@L-Applin L-Applin requested a review from a team as a code owner August 12, 2025 16:48
Copy link
Contributor

@zoewangg zoewangg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to only fix the symptom, not the root cause, can we create a task to fix the root cause?

"type": "bugfix",
"category": "AWS SDK for Java v2",
"contributor": "",
"description": "Fix a potential NullPointerException in ApiCallAttemptTimeoutTrackingStage where the RequestExecutionContext might not have a timeout tracker configured"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: suggesting something more customer facing: Fix a potential NullPointerException that may be thrown when API call timeout is configured.

@L-Applin
Copy link
Contributor Author

This seems to only fix the symptom, not the root cause, can we create a task to fix the root cause?

There is always a risk of this happening, I believe the root cause is when the timeout task is rejected by the SCHEDULED_EXECUTOR_SERVICE. The timeSyncTaskIfNeeded will throw an exception before the the timeout tracker is added to the context via context.apiCallAttemptTimeoutTracker(timeoutTracker).

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants